# Contributor: Jake Buchholz <tomalok@gmail.com>
# Maintainer: Jake Buchholz <tomalok@gmail.com>

pkgname=runc
pkgdesc="CLI tool for spawning and running containers according to the OCI specification"
url="https://www.opencontainers.org"

_commit=24a3cf88a7ae5f4995f6750654c0e2ca61ef4bb2
pkgver=1.0.0_rc91
pkgrel=0

_ver=v${pkgver/_rc/-rc}
# if we're building against an explicit commit beyond pkgver, use this instead:
#_ver=$_commit

arch="all !mips !mips64" # go is missing
license="Apache-2.0"
makedepends="go go-md2man libseccomp-dev libtool"
subpackages="$pkgname-doc"
source="runc-$_ver.tar.gz::https://github.com/opencontainers/runc/archive/$_ver.tar.gz"
builddir="$srcdir/src/github.com/opencontainers/runc"
options="!check"

# secfixes:
#   1.0.0_rc10-r0:
#     - CVE-2019-19921
#   1.0.0_rc9-r0:
#     - CVE-2019-16884
#   1.0.0_rc7-r0:
#     - CVE-2019-5736

build() {
	cd "$srcdir"
	export GOPATH="$PWD"
	mkdir -p "$(dirname "$builddir")"
	ln -s "$PWD/$pkgname-${_ver#v}" "$builddir"
	cd "$builddir"
	make COMMIT="$_commit"
	make man
}

package() {
	install -Dsm755 "$builddir"/runc "$pkgdir"/usr/bin/runc
	install -d "$pkgdir"/usr/share/man/man8/
	install -Dm644 "$builddir"/man/man8/* "$pkgdir"/usr/share/man/man8/
}

sha512sums="9e639c0de1b6bc414fc909c4342590e00d8473b06cfa6e38fa47eef0afb00e811f2b9a83913fb5ad0fa1691e88a9dd9d280367b4f8a9e4746a5c8b522d7ad74c  runc-v1.0.0-rc91.tar.gz"
